<%--
 *  File:    zyldoctorprod.jsp
 *  @Author: shigang 
 *  Date:    2013/3/16
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.zyldoctorprod");  
%>

<% //--------------------------------------  variant and initialization --%>
<%
  	String strModuleName = "COM";
	String privilegeCode = "10340";
	String contextPath = request.getContextPath();
	  Integer nProdgroupId = null;
%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>zyldoctorprod</title>
<PageFlow:CheckPageFlow pageName="p_zyldoctorprod"/>
<%@ include file="/inc/InitEdit.inc" %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%= contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%= contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%= contextPath%>/js/ScriptLib.js"></script>

<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector zyldoctorprod = (Vector)pageContext.getAttribute("zyldoctorprod");
  	if(zyldoctorprod == null) zyldoctorprod = new Vector();	
  	if(nProdgroupId == null)
    {
  		nProdgroupId = (Integer)pageContext.getAttribute("productgroupid");
    }
%>
<script>
function refreshWindow()
{
  parent.down.location.href = "zyldoctorprod.jsp?<%= OvalTools.randomURL() %>&productgroupid=<%=JspHelper.filterNull( nProdgroupId )%>" + "&languagecode=<%= strLanguageCode %>" ;
}
function page_delete()
{
	if(isNullChecked(cform.productgroupmapid))
	{
	  alert("<%=message.getMessageDesc("PLEASE_SELECT")%>");
	  return;
	}
	if(!confirm('<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>')) return;
  	document.cform.actionname.value = "delete";
  	cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}

function page_add()
{   page_selectProd();
 /**   if (isEmpty(document.cform.productid.value)){
    	alert("<%= message.getMessageDesc("Can_not_be_null",label.getLabelName("L_Product"))%>");
        return;
    }
    var id = document.cform.productid.value;
	if(page_checkProdExists(id)) return;
  document.cform.actionname.value = "add";
  cform.target = "_self";
  isRunning = true;
  document.cform.submit();
  **/
}

function page_selectProd() {
        
		var status = "height=400, width=600,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
		var url = "<%= contextPath%>/phap/phap.datp/masterdata/kdm/zylProductSelect.jsp?<%= OvalTools.randomURL() %>&productgroupid=<%=JspHelper.filterNull( nProdgroupId )%>";
		
		if (typeof popwindow != 'undefined') popwindow.close();
		popwindow = window.open(url, "newwindow1", status);
}

function page_setproduct(id,umcode,prodcode,prodname)
{
    document.cform.productid.value = id;
    document.cform.prodcode.value=prodcode;
    document.cform.prodname.value=prodname;
}

function page_checkProdCode(){
	var prodcode = document.cform.prodcode.value;
	
	document.cform.prodname.value = "";
	document.cform.productid.value = "";
	
	if(isEmpty(prodcode)) return;
	
	document.cform.prodcode.value = "";
	
	var  datahandler = new  DataHandler() ;
	datahandler.add_params("prodcode" , prodcode,"String");
	datahandler.getResult("prodname","document.cform.prodname");
	datahandler.getResult("prodcode","document.cform.prodcode"); 
	datahandler.getResult("prodid","document.cform.productid");
	datahandler.add_job("j_getproduct") ;
	datahandler.runDataHandler();
}

function page_checkProdExists(prodid){
	var rownum = document.cform.rownum.value;
	for(var i = 1 ; i < rownum ; i++ ){
		if(prodid == eval('document.cform.productid' + i).value){
			alert("<%= message.getMessageDesc("A_ALREADY_EXISTS",label.getLabelName("L_Product"))%>");
			return true;
		}
	}
	return false;
}
</script>
</head>
<iframe name="reloadHandler" style="display:none" ></iframe>
<body>

	<% //--------------------------------------  hidden form variant --%>
	<form name="cform" method="post" action="<%= contextPath%>/Dispatcher">
    <input type="hidden" name="pagename" value="p_zyldoctorprod">
    <input type="hidden" name="actionname">   
	<custom:hidden property="productgroupid"/>
	<custom:hidden property="doctorid"/>
	<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
          	<tr class="deepblue-left"> 
            	<!--<td width="22" class="title_center">&nbsp;</td> -->
            	<td class="title_center" width="200"><%= label.getLabelName("L_SerialNo") %></td>
            	<td class="title_center" width="200"><%= label.getLabelName("L_Prodcode1") %></td>
            	<td class="title_center" width="*"><%= label.getLabelName("L_Product") %></td>
          	</tr>
          	
          	<%
            	int i = 0;
            	String strClassType = new String("");   
            	boolean bHasChecked = false;
          	%>
          	<logic:iterate id="onerow" collection="<%= zyldoctorprod %>">                      
          	<%
            	String strIsChecked = new String("");
            	if(i%2 == 1)
            	{
              		strClassType = "td-listrom";
            	}else{                    
              		strClassType = "none";
            	}             
            	i++;     
           	%>
          	<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  class="<%=JspHelper.filterNull( strClassType )%>"> 
            	<!-- <td>
            		<custom:checkbox property="productgroupid" name="onerow" styleClass="checkbox"/>
            	</td>-->
            	<td><%=i %><custom:hidden property="prodid" name="onerow" colIndex="<%=new Integer(i) %>"/></td>
            	<td><custom:write property="prodcode" name="onerow" nbsp="true"/></td>
            	<td><custom:write property="prdname" name="onerow" nbsp="true"/></td>
          	</tr>
          	</logic:iterate>         
          	<%
          		String temp = i + 1 + "";
          	%>
          	<custom:hidden property="rownum" value="<%=temp %>"/>
          	<!--  --- -<tr> 	
          		<TD>&nbsp;</TD>
            	<td><%=i+1 %></TD>
              	<TD>
	           		<input type="text" name="prodcode" onchange="javascript:page_checkProdCode();" size="20">
	           		<a onclick="javascript:page_selectProd();"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
	           		<input type="text" name="prodname" readonly size="40"/>
	           		<input type="hidden" name="productid"/>
            	</td>
          	</tr>
               -->
        	</table>
        	
        	<% //--------------------------------------  page operation button --%>
      		<table width="100%" cellspacing="0" cellpadding="0">
        	<tr> 
          		<td class="summary_top"></td>
        	</tr>
        	<tr> 
          		<td class="td_center">
          			<!--  <a onclick="allChecked(cform)"><custom:button type="1" label="L_Saveall" imgsrc="saveall.gif" border="0" style="width:60"/></a>
         <a onclick="allCancel(cform)"><custom:button type="1" label="L_Resetmarks" imgsrc="resetmarks.gif" border="0"/></a>
          		<a onclick="popup('zylProductSelect.jsp?<%= OvalTools.randomURL() %>&productgroupid=<%=JspHelper.filterNull( nProdgroupId )%>','newwindow','height=220, width=600,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no')"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
          		<a onclick="page_add()"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a> 
          			<a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>-->
          		</td>
        	</tr>
      		</table>
</form>
</body>
</html>


